Switching between different versions of Vim on Windows
Using the Windows installer to install Vim with default settings will put the executable in a directory with a name like C:\Program Files\vim\VimXX (where XX is a number such as 72 to indicate version 7.2). When the next version is installed, files will be placed in a new subdirectory, for example Vim73 for version 7.3. This tip describes how to handle the fact that you may have registered Vim as the editor to be used with various applications, and now the path to the executable needs to be changed in multiple locations. Standard procedure The Vim Windows installer offers an option to create a batch file in a directory in the PATH so that batch file can be used to invoke Vim. Just use this batch file to register Vim everywhere. When a new version of Vim arrives, modify this file only (or the installer can do it). Problems: #An irritating black box (command prompt) is visible when Vim is started. #In some circumstances, the name of the executable may be required, and a batch file is not sufficient. Overwrite old version Install the new version of Vim on top of the old one. Problems: #Cannot switch between versions, just upgrade. #After a time, the Vim install directory becomes a mess, containing files from multiple versions. #If Vim was initially installed in Vim72, it is confusing to use that directory to hold version 7.3. Directory link When installing Vim on an NTFS file system (pretty much all new computers), do the following: #Go to the Vim directory (for example, C:\Program Files\vim). #Create a junction (or, better, a symbolic link) named "runtime" to the directory with the executable (for example, C:\Program Files\vim\vim73). The name runtime is important! The linkd command can create and safely delete junctions, see Microsoft's How to create and manipulate NTFS junction points article #Wherever you need to specify a path to gvim.exe, use the path that goes through "runtime". When a new version of Vim arrives, do the following: #Install it in the same main directory, but a different subdirectory (for example, when Vim 7.4 is available, it would be installed in C:\Program Files\vim\vim74). #Go to the Vim directory (for example, C:\Program Files\vim). #Delete the existing junction "runtime" (first close all running Vim instances). Warning: Do NOT simply delete the "runtime" directory from a file explorer or with a del command, this will also delete the contents of the "real" directory it links to. You must use the same tool you used to create the junction, to remove it. #Create a new junction "runtime" to the directory with the new executable (for example, C:\Program Files\vim\vim74). That way, all Vim settings throughout the system should pick up the new Vim version. Comments The easiest way I've found to handle a Vim version upgrade (and also, incidentally, to enable a quick setup on any new system), is to create a .bat file or a registry export file which can be used to create all your file associations. When you upgrade, simply change the path to Vim in this script/registry file and re-run/re-import it to override all the old associations with the new. --Fritzophrenic 04:17, July 8, 2011 (UTC)